<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditFoodTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditFoodLabel_id}" for="id" />
                    <h:inputText id="id" value="#{foodController.selected.id}" title="#{bundle.EditFoodTitle_id}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_id}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_name}" for="name" />
                    <h:inputText id="name" value="#{foodController.selected.name}" title="#{bundle.EditFoodTitle_name}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_name}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_description}" for="description" />
                    <h:inputTextarea rows="4" cols="30" id="description" value="#{foodController.selected.description}" title="#{bundle.EditFoodTitle_description}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_description}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_smallPrice}" for="smallPrice" />
                    <h:inputText id="smallPrice" value="#{foodController.selected.smallPrice}" title="#{bundle.EditFoodTitle_smallPrice}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_smallPrice}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_mediumPrice}" for="mediumPrice" />
                    <h:inputText id="mediumPrice" value="#{foodController.selected.mediumPrice}" title="#{bundle.EditFoodTitle_mediumPrice}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_mediumPrice}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_largePrice}" for="largePrice" />
                    <h:inputText id="largePrice" value="#{foodController.selected.largePrice}" title="#{bundle.EditFoodTitle_largePrice}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_largePrice}"/>
                    <h:outputLabel value="#{bundle.EditFoodLabel_categoryId}" for="categoryId" />
                    <h:selectOneMenu id="categoryId" value="#{foodController.selected.categoryId}" title="#{bundle.EditFoodTitle_categoryId}" required="true" requiredMessage="#{bundle.EditFoodRequiredMessage_categoryId}">
                        <f:selectItems value="#{categoryController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <h:commandLink action="#{foodController.update}" value="#{bundle.EditFoodSaveLink}"/>
                <br />
                <br />
                <h:commandLink action="View" value="#{bundle.EditFoodViewLink}" immediate="true"/>
                <br />
                <h:commandLink action="#{foodController.prepareList}" value="#{bundle.EditFoodShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="#{bundle.EditFoodIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
